import { defineStore } from 'pinia'

export const useUserStore = defineStore('user', {
  state: () => ({
    userId: '',
    role: '',
    name: '',
    token: '',
    studentId: '',
    teacherId: ''
  }),
  actions: {
    setUserInfo(userInfo) {
      this.userId = userInfo.userId
      this.role = userInfo.role
      this.name = userInfo.name
      this.token = userInfo.token
      this.studentId = userInfo.studentId
      this.teacherId = userInfo.teacherId
    },
    clearUserInfo() {
      this.userId = ''
      this.role = ''
      this.name = ''
      this.token = ''
      this.studentId = ''
      this.teacherId = ''
    }
  }
})